package com.ming.study.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ming.study.exceptionHandler.MingException;
import com.ming.study.pojo.User;
import com.ming.study.pojo.UserInfo;
import com.ming.study.pojo.vo.UserLoginVo;
import com.ming.study.service.JwService;
import com.ming.study.service.UserService;
import com.ming.study.utils.R;
import com.ming.study.utils.ResultCode;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mingyue
 * @since 2020-12-15
 */
@RestController
@RequestMapping("/")
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private JwService jwService;

    @PostMapping("/login")
    @ApiOperation("用户登录")
    public R login(@RequestBody UserLoginVo userLoginVo) {
        String token = userService.loginOrRegister(userLoginVo);
        return R.ok().data("token", token);
    }

}

